#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# @Time    : 2022/06/08 20:19
# @Author  : elegantfrog
# @FileName: user.py

from flask import Blueprint, current_app, request
from utils.logs import Logging
from flask_request_id import RequestID
from utils.utils import aUtils
import json
from utils.client import aMqtt

user = Blueprint('user', __name__, url_prefix='/user')
req = RequestID(current_app).id
logging = Logging(__name__)

client = aMqtt().client


@user.route('login', methods=['POST'])
def login():
    try:
        msg = {
            "route": request.url_rule.rule,
            "req-params": json.loads(json.dumps(request.form))
        }
        logging.info(msg)
        return 'hello world'
    except Exception as e:
        logging.error(e)
        return e


@user.route('/userList', methods=['POST'])
def userList():
    try:
        return 'hello'
    except Exception as e:
        print(e)
        logging.error(e)
        return e
